<script type="text/javascript">PageEdit.init();</script>
<ul id="tab_nav">
{foreach from=$edits item=block}
	<li><a href="#">{$block.lang->name}</a></li>
{/foreach}
</ul>
<div id="tab_wrap"> 
{foreach from=$edits item=block_item}
<div class="edit_tab" id="content_frame_{$block_item.lang->id}">
	<form method="post" action="#" onsubmit="PageEdit.Submit(this, {$block_item.lang->id}); return false;">
	<input type="hidden" name="nav_id" id="cv_{$block_item.lang->id}" value="{if isset($block_item.block->nav_id)}{$block_item.block->nav_id}{/if}" />
	<input type="hidden" name="nav_id_get" id="nav_id_get_{$block_item.lang->id}" value="{$smarty.get.nav_id}" />
	<input type="hidden" name="lang_id" value="{$block_item.lang->id}" />
	<table class="form_table" style="width:100%;">
		<tr>
			<td>{lang name="page_edit_field_title"}</td>
			<td>{lang name="page_edit_field_rewrite"}</td>
		</tr>
		<tr>
			<td><input class="text" type="text" name="block_title" id="block_title_{$block_item.lang->id}" value="{if isset($block_item.block->title)}{$block_item.block->title}{/if}" /></td>
			<td><input class="text field_true" type="text" onkeyup="Backend.CheckRwName(this, 'block_save_{$block_item.lang->id}','{if isset($block_item.block->rewrite_link)}{$block_item.block->rewrite_link}{/if}')" name="block_rewrite_link" id="block_rewrite_link_{$block_item.lang->id}" value="{if isset($block_item.block->rewrite_link)}{$block_item.block->rewrite_link}{/if}" /></td>
		</tr>
		<tr>
			<td colspan="2">
				<textarea name="block_text" id="{$smarty.now}_mce_{$block_item.lang->id}">{if isset($block_item.block->text)}{$block_item.block->text|stripslashes}{/if}</textarea>
			</td>
		</tr>
		<tr>
			<td>
				<input class="submit" value="{lang name="page_edit_submit_save"}" type="submit" name="block_save" id="block_save_{$block_item.lang->id}" />
				<div style="display:inline-block; font-size:0.7em; color:#333;">{if isset($block_item.block->date)}Letztes Update am {$block_item.block->date|date_format:"%A, %e. %B %Y um %H:%M"|utf8_encode}{/if}</div>
			</td>
			<td align="right">
				{if isset($block_item.block->rewrite_link)}
				<div style="display:inline; padding:5px; color:#333;" class="button" onclick="window.open('{Tools::BuildLinkByRewrite({$block_item.block->rewrite_link})}','preview','width=990,height=750')">{lang name="page_edit_submit_preview"}</div>
				{/if}
				<div style="display:inline; padding:5px; color:#333;" class="button" onclick="PageEdit.GetVersions('cv_{$block_item.lang->id}',{$block_item.lang->id},'{$smarty.now}_mce_{$block_item.lang->id}', '{if $block_item.block neq false}{$block_item.block->id}{/if}');">{lang name="page_edit_submit_versions"}</div>
			</td>
		</tr>
	</table>
	<script type="text/javascript">tinyMCE.idCounter=0; PageEdit.newMCE('{$smarty.now}_mce_{$block_item.lang->id}');</script>
	</form>
	
	<!-- env vars definition -->
	{if $env_vars->count > 0}
	<div class="innerblock" style="margin-top:10px;"><h1 onclick="PageEdit.EnvLoad({if $block_item.block neq false}{$block_item.block->id}{/if});" style="cursor:pointer;"><img src="{$theme}img/icons/envvars.gif" border="0" /> Umgebungs Variabeln</h1>
	<div id="envvars_{if $block_item.block neq false}{$block_item.block->id}{/if}" style="display:none;">
		<p>Definieren Sie die Umgebungs Variabeln für diese Seite.</p>
		<div style="padding:3px 10px;" id="envvars-container-{if $block_item.block neq false}{$block_item.block->id}{/if}"></div>
	</div>
	</div>
	{/if}
	
	<div id="versions_{$block_item.lang->id}" style="display:none;">loading ...</div>
	
</div>
{/foreach}
</div>

<!-- content images -->
<div class="block" style="margin-top:10px;">
<h1 onclick="Effect.toggle('pageimg', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/picture.png" border="0" /> {lang name="page_edit_imagetab_title"}</h1>
<div id="pageimg" style="display:none;">

	<div id="image_container" style="padding:5px">
		<img src="{$theme}img/loading.gif" border="0" />
	</div>
	
	<div style="padding:5px">
	<div id="image_uploader_container" class="image_former">
	<form action="{$host}?controller=admin&method=add_image_ajax&image_container=image_container" method="post" enctype="multipart/form-data" target="uploader" onsubmit="ImageUpp.Start();">
	<input type="hidden" name="nav_id" value="{$smarty.get.nav_id}" />
	<table class="padding_table">
		<tr>
			<td colspan="2">{lang name="page_edit_imagetab_info"}<div id="image_upp_error" class="false" style="padding:4px; margin-top:6px; display:none;"></div></td>
		</tr>
		<tr>
			<td width="150"><input class="text" type="file" name="image_file" /></td><td><input class="submit" type="submit" name="image_submit" value="Bild Hochladen" /><div style="display:inline-block;"><div id="image_loader" style="display:none; padding-left:10px;"><img src="{$theme}img/loading.gif" border="0" /></div></div>
		</tr>
	</table>
	<iframe id="uploader" name="uploader" src="" style="display:none; height:0px; width:0px;"></iframe>
	</form>
	</div>
	</div>
	
</div>
</div>

<!-- content files (pdf, doc, rawimage(?)) -->
<div class="block" style="margin-top:10px;">
<h1 onclick="Effect.toggle('pagefiles', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/file.gif" border="0" /> Files</h1>
<div id="pagefiles" style="display:none;">
<p>Im Text werden die Zeichen Folgen [Datei X] (wobei X die Nummer der Datei ist) automatisch mit dem dazugehörigen Icon/Bild ersetzt. Falls Sie anstelle eines Icon/Bild 
	eine Text angezeigt haben m&ouml;chten k&ouml;nnen Sie dies wie folgt machen: [Datei X|"Dies ist der Link text"]
	</p>
	<div id="file_container" style="padding:5px">
		<img src="{$theme}img/loading.gif" border="0" />
	</div>
	<div id="log"></div>
	<div style="padding:5px" class="image_former" id="file_uploader_container">
	<form action="{$host}?controller=admin&method=add_file_ajax" method="post" enctype="multipart/form-data" target="file_uploader" onsubmit="FileUpp.Start();">
	<input type="hidden" name="nav_id" value="{$smarty.get.nav_id}" />
	<table class="padding_table">
		<tr>
			<td colspan="2">Hochladen neuer Dateien. Bekannte Formate: Doc, Excel, Exe, Flash(swf), Mov, Mp3, PDF, PSD, Txt, WMV, ZIP. Andere Formate k&ouml;nnen ebenfalls hochgeladen werden, es wurde aber noch kein Icon hinterlegt.</td>
		</tr>
		<tr>
			<td width="150"><input class="text" type="file" name="file" /></td><td><input class="submit" type="submit" name="file_submit" value="File Hochladen" /><div style="display:inline-block;"><div id="file_loader" style="display:none; padding-left:10px;"><img src="{$theme}img/loading.gif" border="0" /></div></div>
		</tr>
	</table>
	<iframe id="file_uploader" name="file_uploader" src="" style="display:none; height:0px; width:0px;"></iframe>
	</form>
	</div>
	
</div>
</div>

<!-- page settings / subpage; categoriy; etc -->
<div class="block" style="margin-top:10px;"><h1 onclick="Effect.toggle('sysprop', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/gear.png" border="0" /> {lang name="page_edit_systab_title"}</h1>
<div id="sysprop" style="display:none;">
<form method="post" action="#" onsubmit="PageEdit.Properties(this); return false;">
<input type="hidden" name="nav_id" value="{$smarty.get.nav_id}" />
<table class="padding_table" style="width:100%;">
	<tr>
		<td width="16"><img src="{$theme}img/icons/cata.png" border="0" /></td>
		<td width="90"><strong>{lang name="page_edit_systab_info1"}</strong></td>
		<td><select name="cat_id" id="cat_field" class="text" onchange="AddPage.LoadNav()">
			{foreach from=$cats item=item}
				<option value="{$item->rewrite_link}" {if $item->id == $nav_obj->cat}selected="selected"{/if}>{$item->title}</option>
			{/foreach}
		</select>
		</td>
	</tr>
<tr>
	<td><img src="{$theme}img/icons/page-sub.gif" border="0" /></td>
	<td><strong>{lang name="page_edit_systab_info2"}</strong></td>
	<td>
		<select name="parent" id="parent_field" class="text">	
		</select>
	</td>
</tr>
<tr>
	<td colspan="3"><input type="submit" name="save_prop" value="Einstellungen Speichern" class="submit" /></td>
</tr>
</table>
</form>
</div>
</div>

<!-- which user can change content for this page -->
<div class="block" style="margin-top:10px;"><h1 onclick="Effect.toggle('userprop', 'slide'); PageEdit.UserRightsLoad({$smarty.get.nav_id});" style="cursor:pointer;"><img src="{$theme}img/icons/unlock.png" border="0" /> Benutzer Berechtigung <div id="user-rights-loader" style="display:none; dispay:inline-block; float:right; margin-top:6px;"><img src="{$theme}img/loading.gif" border="0" /></div></h1>
<div id="userprop" style="display:none;">
	<p>Markieren Sie alle Benutzer welche die volle kontrolle für diese Seite erhalten (Bearbeiten und L&ouml;schen). Nicht markierte Benutzer k&ouml;nnen diese Seite nicht modifizieren.</p>
	<div style="padding:3px 10px;" id="user-rights-container"></div>
</div>
</div>

<script type="text/javascript">ImageList.Load({$smarty.get.nav_id}, 'image_container');</script>
<script type="text/javascript">FileList.Load({$smarty.get.nav_id});</script>
<script type="text/javascript">AddPage.LoadNav('{$nav_obj_cat_rw}');</script>